package com.huatai.exchange.receive;

import com.faneui.common.exception.BusinessException;
import com.huatai.exchange.facade.CommunicationConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class FileDataReceiveFactory {

    @Autowired
    private FileDataReceiveService fileDataFtpReceiveService;

    @Autowired
    private FileDataReceiveService fileDataHttpReceiveService;

    @Autowired
    private FileDataReceiveService fileDataMailReceiveService;

    @Autowired
    private FileDataReceiveService fileDataSmbReceiveService;

    @Autowired
    private FileDataReceiveService fileDataSztReceiveService;

    @Autowired
    private FileDataReceiveService fileDataCmdReceiveService;


    public FileDataReceiveService getReceiveService(String receiveType) throws BusinessException {
        if (CommunicationConstants.COMMUNICATION_MAIL.equals(receiveType)) { // http 获取文件
            return fileDataMailReceiveService;
        } else if (CommunicationConstants.COMMUNICATION_SZT.equals(receiveType)) {
            return fileDataSztReceiveService;
        } else if (CommunicationConstants.COMMUNICATION_SMB.equals(receiveType)) {
            return fileDataSmbReceiveService;
        } else if (CommunicationConstants.COMMUNICATION_FTP.equals(receiveType)) {
            return fileDataFtpReceiveService;
        } else if (CommunicationConstants.COMMUNICATION_HTTP.equals(receiveType)) {
            return fileDataHttpReceiveService;
        } else if (CommunicationConstants.COMMUNICATION_CMD.equals(receiveType)) {
            return fileDataCmdReceiveService;
        } else {
            throw new BusinessException("无效沟通类型");
        }
    }

}
